<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>thymeleaf的应用</title>
    <!--<link rel="stylesheet" href="css/index.css">-->
    <!--静态路径串接@{static中的路径}-->
    <link rel="stylesheet" th:href="@{css/{temp}(temp=${index}+'.css')}">
</head>
<body>
<h2>1.thymeleaf常规操作</h2>
<div class="header"></div>
<div class="main">
    <div class="nav"><a href="http://www.ifeng.com">凤凰网</a> <a href="#">美食</a>  </div>
    <div class="content">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. A animi aperiam aspernatur assumenda atque autem cumque cupiditate est et expedita, itaque nisi nostrum numquam unde voluptatibus? A aspernatur atque consequuntur deleniti ducimus numquam quaerat sequi sint voluptatibus? Accusamus deleniti iste quod sunt! Amet animi asperiores aut consectetur debitis delectus doloremque id, ipsa labore minus nesciunt nobis nostrum odit officiis omnis placeat porro quaerat quam qui quia ullam unde velit voluptas. Aliquam aspernatur atque cum, eaque enim harum in laboriosam magnam mollitia nisi nostrum nulla officiis, perferendis qui recusandae sit soluta ut voluptatibus. Dicta id quod vero voluptatibus. Doloremque facilis laudantium nihil qui rem? Amet atque consequuntur dolores impedit in incidunt, iusto maiores maxime molestiae nihil quasi quia suscipit tempore voluptas?
        <!--普通字符串对象-->
        <p th:text="${msg}"></p>
        <!--对象的获取-->
        <h3 th:text="${'姓名：'+user.name}"></h3>
        <h3 th:text="${'学号：'+user.uid}"></h3>
        <h3>人间四月芳菲尽<span th:text="${user.name}"></span></h3>
        <h4 th:id="${'uid'}">我是1001</h4>
        <h3>2.遍历集对象</h3>
        <table>
            <tr><th>序号</th><th>工号</th><th>姓名</th></tr>
            <!--通过三目运算，设置不同的类名-->
            <tr th:each="user,st:${users}" th:class="${st.odd}?'odd':'even'">
                <!--默认的状态对象为userStat,属性有：
                index,count,size,first,last,odd,even,current-->
                <td th:text="${st.index+1}"></td>
                <td th:text="${user.uid}"></td>
                <td th:text="${user.name}"></td>
            </tr>
        </table>
        <!--判断对象是否为空，如果为空则进行提示-->
        <h4 th:if="${user==null}">
            此处网络有误!
        </h4>
    </div>
</div>
<div class="footer">
    北大青鸟&copy;All right Reserved.
</div>
</body>
</html>